package com.app.util;

import com.app.entity.TemplateEntity;
import freemarker.template.Template;
import freemarker.template.TemplateException;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;


public class FreemarkerUtil {
    public static void generateFreemarkerFile(File file, Template t, TemplateEntity s) {
        try {
            FileOutputStream fos = new FileOutputStream(file); //java文件的生成目录
            t.process(s, new OutputStreamWriter(fos, "utf-8")); //
            fos.flush();
            fos.close();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (TemplateException e) {
            e.printStackTrace();
        }
    }


}
